<template>
  <el-table :data="detail" border style="width: 100%">
    <el-table-column label="立案日期" prop="date" show-overflow-tooltip />
    <el-table-column label="案号" prop="caseNumber" show-overflow-tooltip />
    <el-table-column label="受理法院" prop="court" show-overflow-tooltip />
    <el-table-column label="当事人" width="300" show-overflow-tooltip>
      <template #default="scope">
        <div v-for="(item, index) in JSON.parse(scope.row.relatedCompanies)" :key="index">
          {{ item.role }}:{{ filterArr(item.nameArr) }}
        </div>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup lang="ts">
const props = defineProps({
  detail: Array
})
const filterArr = (val) => {
  if (typeof val === 'object' && Array.isArray(val)) {
    return val.join(',')
  }
  return val
}
</script>

<style lang="scss" scoped>
.mb-20px {
  margin-bottom: 20px;
}
</style>
